import { AxiosPromise } from 'axios';
import request from '@/utils/request';

export function planListAll(visitDate: string): AxiosPromise<any> {
  return request({
    url: '/wiki/plan/list',
    method: 'get',
    params: { visitDate }
  });
}

export function getPlanByDate(date: string) {
  return request({
    url: 'wiki/plan/getPlanByDate/' + date,
    method: 'get'
  });
}

export function planDetail(id: string): AxiosPromise<any> {
  return request({
    url: '/wiki/plan/' + id,
    method: 'get'
  });
}

export function savePlan(data: any): AxiosPromise<any> {
  return request({
    url: '/wiki/plan',
    method: 'post',
    data
  });
}

export function updatePlan(data: any): AxiosPromise<any> {
  return request({
    url: '/wiki/plan',
    method: 'put',
    data
  });
}

export function deletePlan(id: string): AxiosPromise<any> {
  return request({
    url: '/wiki/plan/' + id,
    method: 'delete'
  });
}

export function joiningPeers(data: { id: string }) {
  return request({
    url: '/wiki/plan/joiningPeers',
    method: 'put',
    data
  });
}

export function exitPeers(data: { id: string }) {
  return request({
    url: '/wiki/plan/exitPeers',
    method: 'put',
    data
  });
}
